import Vue from 'vue'
import Router from 'vue-router'
import Main from "../components/Main.vue";
import Home from "../components/Home.vue";
import Other from "../components/Other.vue";
import Notice from "../components/Notice.vue";
import Login from "../components/Login.vue";
import SelectionTopic from "../components/SelectionTopic.vue";
import FileDownload from "../components/FileDownload.vue";
import Gtss from "../components/Gtss.vue";
import TopicReview from "../components/TopicReview.vue";
import GtssReview from "../components/GtssReview.vue";
Vue.use(Router)

const routes = [


  {
    path: '/login',
    name: 'Login',
    component: Login,
  },
  {
    path: '/',
    redirect: '/login', // 根路径重定向到登录页面
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/notice',
    children: [
      {
        path: 'notice',
        name: 'Notice',
        component: Notice
      },
      {
        path: 'selectiontopic',
        name: 'SelectionTopic',
        component: SelectionTopic
      },
      {
        path: 'filedownload',
        name: 'FileDownload',
        component: FileDownload
      },
      {
        path: 'gtss',
        name: 'Gtss',
        component: Gtss
      },
      {
        path: 'topicreview',
        name: 'TopicReview',
        component: TopicReview
      },
      {
        path: 'gtssreview',
        name: 'GtssReview',
        component: GtssReview
      }
      // {
      //   path: 'main',
      //   name: 'Main',
      //   component: Main,
      // },
      // {
      //   path: 'other',
      //   name: 'Other',
      //   component: Other
      // },

    ]
  },
]

const router = new Router({
  mode: "history",
  routes
})
// 重定义 Router.prototype.push 方法来避免重复导航错误
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
}


export default router
